#include <stdio.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "environment_task.h"
#include "oled_task.h"
#include "publish_task.h"

void ems_thread(void *arg){
    (void)arg;
    sleep(2);
    printf("envir...\n");
    envionment_task();
    oled_task();
    publish_task();
}

void ems_entry(void){
    
    osThreadAttr_t attr;
    attr.name = "ems_main";
    attr.attr_bits = 0U;
    attr.cb_mem = NULL;

    attr.cb_size = 0U;
    attr.stack_mem = NULL;
    attr.stack_size = 4096;
    attr.priority = 36;


    if (osThreadNew((osThreadFunc_t) ems_thread,NULL,&attr)==NULL)
    {
        printf("ems_main create failed.\n");
    }
}

SYS_RUN(ems_entry);